package com.service;

import com.dao.TypeRepository;
import com.po.Activity;
import com.po.Type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TypeServiceImpl implements TypeService{
    @Autowired
    private TypeRepository typeRepository;

    @Override
    public List<Type> findAll() {
        return typeRepository.findAll();
    }

    @Override
    public List<Type> listTypeTop(Integer size) {
        Pageable pageable =PageRequest.of(Integer.parseInt(String.valueOf(0)), Integer.parseInt(String.valueOf(size)));
        return typeRepository.findTop(pageable);
    }


}
